﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Security;


namespace VideoWorld
{
    public class FinishUserInfo : System.Web.UI.Page
    {
        DataAccess.Users users = new DataAccess.Users(Global.ConnectionString);
        private String name = String.Empty;
        protected System.Web.UI.WebControls.Button btVideos;
        protected System.Web.UI.WebControls.Button btIndex;
        public String info = String.Empty;

        private void Page_Load(object sender, System.EventArgs e)
        {
            //判断用户权限
            if (Session["userName"] == null)
            {
                String errorMessage = "您还没有登录";
                if (Session["loginError"] != null)
                {
                    errorMessage = Session["loginError"].ToString();
                }
                if (errorMessage == "您的充值卡已经过期,或者没有购买充值，请购买新的充值卡进行充值!")
                {
                    Response.Redirect("ChargeCard.aspx");
                }
                else
                {
                    Response.Redirect("login.aspx?error=" + errorMessage);
                }

            }
            //判断用户用卡是否正常
            else if (Session["allow"] == null)
            {
                Response.Redirect("ChargeCard.aspx");
            }
        }
        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.btVideos.Click += new System.EventHandler(this.btVideos_Click);
            this.btIndex.Click += new System.EventHandler(this.btIndex_Click);
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion
        //进入网站服务
        private void btVideos_Click(object sender, System.EventArgs e)
        {
            Page.Response.Redirect("Videos/main.aspx");
        }
        //返回首页
        private void btIndex_Click(object sender, System.EventArgs e)
        {
            Response.Redirect("index.aspx");
        }
    }
}
